
package org.sith.taskrunner.ejb;

import org.sith.taskrunner.api.user.Role;
import org.sith.taskrunner.api.user.SystemUser;
import org.sith.taskrunner.api.user.User;
import org.sith.taskrunner.util.UserImpl;


public class UserThreadKeeper {

    private static final ThreadLocal<User> currentUser = new ThreadLocal<User>();
    private static final SystemUser systemUser = new SystemUser();

    public static void setThreadUser(User user) {
        currentUser.set(user);
    }

    public static void clear() {
        currentUser.remove();
    }

    public static User getThreadUser() {
        return currentUser.get();
    }


    public static void setSystemUser() {
        currentUser.set(systemUser);
    }
}
